package hn.cch.dao.impl;

import hn.cch.jdbc.JdbcDao;
import hn.cch.dao.CityDao;
import hn.cch.model.City;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * Created by chench on 2020-5-21.
 */

@Component(value = "cityDao")
public class CityDaoImpl extends JdbcDao implements CityDao {
    @Override
    public List<City> getAll() {
        StringBuffer sql = new StringBuffer();
        sql.append("select city_id from c_city");
        List<City> list = getCenterJdbcTemplate().query(sql.toString(), new BeanPropertyRowMapper(City.class));
        return list;
    }
}
